if[-fjdk-7u65-linux-i586. rpm ]
then
java &> /dev/nu1l
if[$?-eq 0 ]
then
echo "已经安装JDK"
exit 1
else
echo“开始安装JDK"
rpm -ivh jdk -7u65-linux- 1586. rpm &>/dev/nu1l
echo "JDK安装完成,开始配置环境变量”
echo” export JAVA_ HOME=/usr/java/jdk1.8.0 65’> /etc/profile.d/jdkconf .sh 
echo ' export PATH=$JAVA_ HOME/bin:$PATH’ >> /etc/profile.d/jdkconf .sh
echo ' export CLASSPATH=. :$JAVA_ HOME/lib/dt. jar:$JAVA_ HOME/lib/tools.jar' >> /etc/profile . d/jdkconf . sh
echo“环境变量配置完成"
fi
else
echo“请将当前shell脚本和安装包放在同一目录"
fi
javac HelloWprld. java
java HellpWorld
